package com.wyq.action;

import java.util.List;

import net.sf.json.JSONArray;

import com.opensymphony.xwork2.ActionSupport;
import com.wyq.service.CompanyService;

public class AdminGetCompanyByIdAction extends ActionSupport {
	private CompanyService companyService;
	private String jsonStr;
	private String id;
	
	public void setCompanyService(CompanyService companyService) {
		this.companyService = companyService;
	}
	
	public String getJsonStr() {
		return jsonStr;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Override
	public String execute() throws Exception {
		List list = companyService.getCompanyById(id);
		if(list.size() > 0){
			jsonStr = "{companyInfo:" + JSONArray.fromObject(list).toString() + "}";
		}
		System.out.println("得到企业信息：" + jsonStr);
		return SUCCESS;
	}
	
}
